package ve.com.ucv.changedetection.objects;

//import com.google.code.morphia.annotations.Entity;

import java.util.ArrayList;

/**
 * Created with IntelliJ IDEA.
 * User: Jose Manuel Aguirre
 * Date: 16/10/12
 * Time: 02:26 PM
 * To change this template use File | Settings | File Templates.
 */
//@Entity
public class TreeNode {
    String nodeName;
    String nodeValue;
    String nodeType;
    int hashValue;
    int depth;
    ArrayList<Attribute> attributes;
    ArrayList<TreeNode> childNodes;
    public boolean changed;

    public TreeNode(){
        this.nodeName = null;
        this.nodeValue = null;
        this.nodeType = null;
        this.hashValue = 0;
        this.depth = 0;
        this.attributes = new ArrayList<Attribute>();
        this.childNodes = new ArrayList<TreeNode>();
        this.changed = false;
    }

    public TreeNode(String nodeName, String nodeValue, String nodeType, int hashValue,ArrayList<Attribute> attributes, ArrayList<TreeNode> childNodes, int depth, boolean changed){
        this.nodeName = nodeName;
        this.nodeValue = nodeValue;
        this.nodeType = nodeType;
        this.hashValue = hashValue;
        this.attributes = attributes;
        this.childNodes = childNodes;
        this.depth = depth;
        this.changed = false;
    }

    public String getNodeName() {
        return nodeName;
    }

    public void setNodeName(String leafName) {
        this.nodeName = leafName;
    }

    public String getNodeValue() {
        return nodeValue;
    }

    public void setNodeValue(String nodeValue) {
        this.nodeValue = nodeValue;
    }

    public int getHashValue() {
        return hashValue;
    }

    public void setHashValue(int hashValue) {
        this.hashValue = hashValue;
    }

    public int getDepth() {
        return depth;
    }

    public void setDepth(int depth) {
        this.depth = depth;
    }

    public ArrayList<TreeNode> getChildNodes() {
        return childNodes;
    }

    public void setChildNodes(ArrayList<TreeNode> childNodes) {
        this.childNodes = childNodes;
    }

    public TreeNode getChild(int index){
        return this.childNodes.get(index);
    }

    public void setChild(TreeNode child){
        this.childNodes.add(child);
    }

    public ArrayList<Attribute> getAttributes() {
        return attributes;
    }

    public void setAttributes(ArrayList<Attribute> attributes) {
        this.attributes = attributes;
    }

    public Attribute getAttribute(int index){
        return this.attributes.get(index);
    }

    public void setAttribute(Attribute attribute){
        this.attributes.add(attribute);
    }

    public String getNodeType() {
        return nodeType;
    }

    public void setNodeType(String nodeType) {
        this.nodeType = nodeType;
    }

    public boolean isChanged() {
        return changed;
    }

    public void setChanged(boolean changed) {
        this.changed = changed;
    }
}
